<?php
/**
 * @Notes: 文件描述
 * @Interface getCondition
 * @Return mixed
 * @Author: fc
 * @Time: 2021/9/22 20:35
 */

namespace app\index\controller;

use app\common\model\Goods;
use app\common\model\Order;
use think\facade\Cache;
use think\facade\Log;
use think\Db;
use think\Controller;

class PayNotify extends Controller
{

    public function weixinNotify()
    {
        //$info = Order::where('id', 365)->find();
        //Log::info('=================开始测试==============');

        $orderModel = new Order();
        $updateData['order_state'] = 99;
        $updateData['update_time'] = time();
        $updateData['id'] = 366;
        //$re = $orderModel->where('id', 365)->update($updateData);

        Db::startTrans();
        try {
            $re = Order::update($updateData);
            Db::commit();
        }catch (\Exception $e) {
            Db::rollback();
        }

        return 15646546;

        //Db::startTrans();
        //try {
        //    $orderModel->save($updateData);
        //
        //    Db::commit();
        //}catch (\Exception $e) {
        //    Db::rollback();
        //
        //    return $e->getMessage();
        //}
        //
        //return '213213';

        //return $re;

        //$orderModel = new Order();
        //$data = [
        //    [
        //        'user_id' => 999,
        //        'goods_item_id' => 22
        //    ],
        //    [
        //        'user_id' => 999,
        //        'goods_item_id' => 23
        //    ]
        //];
        //$re = $orderModel->saveAll($data);
        //var_dump($re);die;

        // 更新主订单

        // 更新子订单

        // 商品库存

        // 取消统拍场次(统拍订单)

        // 更新所有其他用户订单(主订单/子订单 -失效)

        // 更新议价

    }

    public function batchInert()
    {
        $orderModel = new Order();

        $data = [
            [
                'user_id' => 999,
                'goods_item_id' => 22
            ],
            [
                'user_id' => 999,
                'goods_item_id' => 23
            ]
        ];

        $orderModel->saveAll($data);
    }



}